<template>
  <div ref="xz80">
    <div class="temp_plate print-wrap-80 print-wrap-normal"
      style="width: 80mm;font-size: 12px;
        padding: 10px;
        border: 1px solid #a5a5a5;
        box-shadow: 2px 2px 2px #d3d3d3;text-align: left;"
    >
      <h2 style="text-align:center; ">
        {{ seller ? seller.sellerName : '酒店' }}续住单
      </h2>

     <p class="panelone panelone1_2 panelone2">
       <span>打印时间:</span>
       <span>{{ changInfo ? changInfo.printingTime : '2019-09-01 02:30' }}</span>
     </p>

     <table style="font-size:13px; border:1px solid #000;text-align: center; border-collapse: collapse; padding:2px;width:100%">
       <tr>
         <td style="border:1px solid #000;text-align: left;" colspan="2">
           <span>客人姓名</span>
         </td>
         <td style="border:1px solid #000;" colspan="2">
           <span style="font-weight: bold;">{{ changInfo ? changInfo.name : '貂蝉' }}</span>
         </td>
       </tr>
       <tr>
         <td style="border:1px solid #000;text-align: left;" colspan="2">
           <span>房号</span>
         </td>
         <td style="border:1px solid #000;" colspan="2">
           <span style="font-weight: bold;">{{ changInfo ? changInfo.roomNum : 'A1' }}</span>
         </td>
       </tr>
       <tr>
         <td style="border:1px solid #000;text-align: left;" colspan="2">
           原离店时间
         </td>
         <td style="border:1px solid #000;" colspan="2">
           {{ changInfo ? changInfo.oldTime : '2019-09-02 02:00' }}
         </td>
       </tr>
       <tr>
         <td style="border:1px solid #000;text-align: left;" colspan="2">
           新离店时间
         </td>
         <td style="border:1px solid #000;" colspan="2">
           {{ changInfo ? changInfo.newTime : '2019-09-02 02:30' }}
         </td>
       </tr>

       <tr>
         <td style="border:1px solid #000;text-align: left;" colspan="2">
           <span>原房价</span>
         </td>
         <td style="border:1px solid #000;" colspan="2">
           <span style="font-weight: bold;">{{ changInfo ? changInfo.oldRoomPrice : '198' }}</span>
         </td>
       </tr>

       <tr>
         <td style="border:1px solid #000;text-align: left;" colspan="2">
           <span>现房价</span>
         </td>
         <td style="border:1px solid #000;" colspan="2">
           <span style="font-weight: bold;">{{ changInfo ? changInfo.newRoomPrice : '198' }}</span>
         </td>
       </tr>
       <tr>
         <td style="border:1px solid #000;text-align: left;" colspan="2">
           <span>本次付款方式</span>
         </td>
         <td style="border:1px solid #000;" colspan="2">
           <span>{{ changInfo ? changInfo.paymentType : '微信' }}</span>
         </td>
       </tr>
       <tr>
         <td style="border:1px solid #000;text-align: left;" colspan="2">
           <span>本次付款金额</span>
         </td>
         <td style="border:1px solid #000;" colspan="2">
           <span>{{ changInfo ? changInfo.payment : '198' }}</span>
         </td>
       </tr>

       <tr>
         <td style="border:1px solid #000;text-align: center;" colspan="2"><span>备注</span></td>
         <td style="border:1px solid #000;" colspan="2">
           <span>{{ changInfo ? changInfo.remarks : '无' }}</span>
         </td>
       </tr>

      </table>      
      
      <div style="margin-top: 8px;"></div>
      <div v-html="note" class="mf15mmwithbigsize"></div>
      
      <div style="text-align: right;margin: 8px 0px;">
        操作员：{{changInfo?changInfo.operator:'System'}}
      </div>

      <div style="font-weight:bold;font-size:16px;margin-top:18px; ">
        <span class="signtext" style="width:40%;">住客签字:</span>
        <span style="width:55%;" class="inputspan"></span>
      </div>
    </div>
  </div>
</template>

<script>
import moment from 'moment';
export default {
  props: {
    //备注
    note: {
    	type: String,
    	default: ''
    },
  },
  data() {
    return {
      nowDate: '', // 当前日期
      nowTime: '', // 当前时间
      nowWeek: '', // 当前星期
      today: moment().format('YYYY-MM-DD'),
      user: {},
      changInfo:{},
    };
  },
  methods: {
    setData(changInfo){
      this.changInfo = changInfo
    },
    currentTime() {
      setInterval(this.getDate, 500);
    },
    getUser() {
      this.$http({
        url: this.$http.adornUrl(`/hotel/thotelprinttemplate/printInfo`),
        method: 'get'
      }).then(({ data }) => {
        if (data.code === 0) {
          this.user = data.user;
          this.seller = data.seller;
        }
      });
    },
    getDate: function() {
      var _this = this;
      let yy = new Date().getFullYear();
      let mm = new Date().getMonth() + 1;
      let dd = new Date().getDate();
      let week = new Date().getDay();
      let hh = new Date().getHours();
      let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes();
      if (week == 1) {
        this.nowWeek = '星期一';
      } else if (week == 2) {
        this.nowWeek = '星期二';
      } else if (week == 3) {
        this.nowWeek = '星期三';
      } else if (week == 4) {
        this.nowWeek = '星期四';
      } else if (week == 5) {
        this.nowWeek = '星期五';
      } else if (week == 6) {
        this.nowWeek = '星期六';
      } else {
        this.nowWeek = '星期日';
      }
      _this.nowTime = hh + ':' + mf;
      _this.nowDate = yy + '/' + mm + '/' + dd;
    }
  },
  mounted() {
    this.currentTime();
    this.getUser();
  }
};
</script>

<style lang="scss">
</style>
